<template>
  <div id="app">
    <TheHeader></TheHeader>
    <router-view/>
    <SongAudio></SongAudio>
    <TheAside></TheAside>

    <PlayBar></PlayBar>
    <ScollTop></ScollTop>
  </div>
</template>

<script>
  import SongAudio from './components/SongAudio.vue';
  import PlayBar from './components/PlayBar.vue';
  import TheAside from './components/TheAside.vue';
  import TheHeader from './components/TheHeader.vue';
  import ScollTop from './components/ScrollTop.vue';
export default {
  components:{
    TheHeader,
    SongAudio,
    TheAside,
    PlayBar,
    ScollTop
  },
  created() {
      // this.$store.commit('setActiveName', '首页');
  },

  name: 'App',
  mounted() {
    //在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener("unload",this.saveState());
  },
  methods:{
    saveState(){
      sessionStorage.setItem("state",JSON.stringify(this.$store.state));
    }
  }
}
</script>

<style scoped>
</style>
